package com.alu4r.atcrowdfunding.manager.controller;

import com.alu4r.atcrowdfunding.bean.Permission;
import com.alu4r.atcrowdfunding.manager.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@RequestMapping("/permission")
public class PermissionToPageController {
    @Autowired
    PermissionService permissionService;


    @RequestMapping("/toEdit")
    public String toEdit(Integer id, Map<String, Object> map){
        Permission permission = permissionService.getPermission(id);
        System.out.println(permission.getUrl());
        map.put("permission",permission);
        System.out.println("跳转到修改许可");
        return "permission/edit";
    }
    @RequestMapping("/toIndex")
    public String toIndex(){
        System.out.println("跳转到许可维护模块");
        return "permission/index";
    }

    @RequestMapping("/toAdd")
    public String toAdd(){
        System.out.println("跳转到增加许可");
        return "permission/add";
    }
}
